package com.snoob.serviceAdmin.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.snoob.serviceAdmin.user.entity.SysUserEntity;
import com.snoob.serviceAdmin.user.mapper.SysUserMapper;
import com.snoob.serviceAdmin.user.service.SysUserService;
import com.snoob.springcloudalibaba.pipleline.qo.SelectSysUserQo;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统管理员 服务实现类
 * </p>
 *
 * @author lixing_java@163.com
 * @since 2022-05-17
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity> implements SysUserService {

    /**
     * @描述 根据账号或者手机号码查询系统用户
     */
    @Override
    public SysUserEntity selectSysUserByAccountOrPhone(SelectSysUserQo qo) {
        // 根据账号或手机号码查询
        SysUserEntity sysUserEntity = this.getBaseMapper().selectOne(new QueryWrapper<SysUserEntity>()
                .select("user_account", "user_phone", "user_password", "active")
                .eq("user_account", qo.getAccount()).or().eq("user_phone", qo.getAccount())
        );
        return sysUserEntity;
    }
}
